/*--------------------------------------------------------------------------------
 * 
 *
 * ===Copyright===
 * Copyright (C) 2008 toge (toge.mail@gmail.com)
 * (See Copyright Notice at COPYRIGHT file)
 *
 * ===Licence===
 * Mit License
 *
 * ===Revision===
 * $Revision: 117 $
 -------------------------------------------------------------------------------*/
#include "Effect.h"
#include "Model.h"

using namespace ggl2d;

bool
BulletBurst::init(const Vector& position, const Vector& speed, float lifetime, float size)
{
  if (size == 0.f)
  {
    const Constants& constants = Constants::instance();
    size = constants.bulletBurstSize();
  }

  startTime_ = FrameClock::now().trueTime();

  position_ = position;
  speed_    = speed;
  lifetime_ = lifetime;
  size_     = size;

  return true;
}

void
BulletBurst::update(Model& model)
{
  if (lefttime() <= 0.f)
  {
    model.effects().kill(*this);
    return;
  }
}
